
# utils/password_generator.py - 密码哈希生成工具
import streamlit_authenticator as stauth

def generate_password_hash(password: str) -> str:
    """生成密码哈希值"""
    return stauth.Hasher([password]).generate()[0]

# 使用示例
if __name__ == "__main__":
    passwords = ['admin123', 'user123']
    hashed_passwords = stauth.Hasher(passwords).generate()
    for i, password in enumerate(passwords):
        print(f"原密码: {password}")
        print(f"哈希值: {hashed_passwords[i]}\n")